/*
* @(#)<FileUtil>
*
* 金蝶软件（中国）有限公司版权所有
*/

package com.kingdee.fpy;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;

/**
* 描述：
* @author chuang_li  date:<2022/03/14> <p>
*
* @version <FPY1.0>
*/
public class FileUtil {
	
	public static byte[] fileConvertToByteArray(File file) {
        byte[] data = null;
        try {
            FileInputStream fis = new FileInputStream(file);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            int len;
            byte[] buffer = new byte[1024];
            while ((len = fis.read(buffer)) != -1) {
                baos.write(buffer, 0, len);
            }
            data = baos.toByteArray();
            fis.close();
            baos.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }

}